home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1994 November: Tool Chest / Dev.CD Nov 94.toast / Tool Chest / Development Tools & Languages / Macintosh Common Lisp Related / interfaces / AppleScript.lisp next >
Encoding:
Text File  |  1994-09-13  |  5.6 KB  |  145 lines  |  [TEXT/CCL2]

  1.  
  2. (in-package :TRAPS)             ; 
  3. ; ////////////////////////////////////////////////////////////////////////////////
  4. ; // OPEN SCRIPTING ARCHITECTURE: Client Interface
  5. ; ////////////////////////////////////////////////////////////////////////////////
  6. ; // Copyright © 1992 Apple Computer, Inc. All rights reserved.
  7. ; // Authors: Jens Alfke, William Cook, Donn Denman, and Warren Harris
  8. ; ////////////////////////////////////////////////////////////////////////////////
  9. ; // This interface defines what it means to be a "scripting component."
  10. ; // Scripting components allow "scripts" to be loaded and executed.  This
  11. ; // interface does not define the way in which a particular scripting
  12. ; // component's scripts are editing and debugged.
  13. ; ////////////////////////////////////////////////////////////////////////////////
  14.  
  15. ; $IFC UNDEFINED UsingIncludes
  16. ; $SETC UsingIncludes := 0
  17. ; $ENDC
  18.  
  19. ; $IFC NOT UsingIncludes
  20.  
  21. ; $ENDC
  22.  
  23. ; $IFC UNDEFINED UsingAppleScript
  24. ; $SETC UsingAppleScript := 1
  25.  
  26. ; $I+
  27. ; $SETC AppleScriptIncludes := UsingIncludes
  28. ; $SETC UsingIncludes := 1
  29. ; $IFC UNDEFINED UsingAppleEvents
  30.  
  31. (require-interface 'APPLEEVENTS); $I $$Shell(PInterfaces)AppleEvents.p
  32. ; $ENDC
  33. ; $IFC UNDEFINED UsingComponents
  34.  
  35. (require-interface 'COMPONENTS) ; $I $$Shell(PInterfaces)Components.p
  36. ; $ENDC
  37. ; $IFC UNDEFINED UsingOSA
  38.  
  39. (require-interface 'OSA)        ; $I $$Shell(PInterfaces)OSA.p
  40. ; $ENDC
  41. ; $IFC UNDEFINED UsingTextEdit
  42.  
  43. (require-interface 'TEXTEDIT)   ; $I $$Shell(PInterfaces)TextEdit.p
  44. ; $ENDC
  45. ; $SETC UsingIncludes := AppleScriptIncludes
  46.  
  47. ;  Types and Constants 
  48.  
  49. (defconstant $typeAppleScript :|ascr|)
  50. (defconstant $kAppleScriptSubtype #$TYPEAPPLESCRIPT)
  51. (defconstant $typeASStorage #$TYPEAPPLESCRIPT)
  52.  
  53. ;  Error Codes 
  54.  
  55. ;  Runtime errors 
  56. (defconstant $errASCantConsiderAndIgnore -2720)
  57. (defconstant $errASCantCompareMoreThan32k -2721)
  58.  
  59. ;  Compiler errors 
  60. (defconstant $errASTerminologyNestingTooDeep -2760)
  61. (defconstant $errASIllegalFormalParameter -2761)
  62. (defconstant $errASParameterNotForEvent -2762)
  63. (defconstant $errASNoResultReturned -2763)
  64.  
  65. ;  Dialect specific errors 
  66. ;  The range -2780 thru -2799 is reserved for dialect specific error codes. 
  67. ;  (Error codes from different dialects may overlap.) 
  68.  
  69. ;  English errors 
  70. (defconstant $errASInconsistentNames -2780)
  71.  
  72. ;  Component Selectors 
  73. (defconstant $kASSelectInit #X1001)
  74. (defconstant $kASSelectSetSourceStyles #X1002)
  75. (defconstant $kASSelectGetSourceStyles #X1003)
  76. (defconstant $kASSelectGetSourceStyleNames #X1004)
  77.  
  78. ;  OSAGetScriptInfo Selectors 
  79. (defconstant $kASHasOpenHandler :|hsod|)
  80.  
  81. ;  Initialization 
  82.  
  83.  
  84. (deftrap _asinit ((scriptingcomponent (:pointer :componentinstancerecord)) (modeflags :signed-long) (minstacksize :signed-long) (preferredstacksize :signed-long) (maxstacksize :signed-long) (minheapsize :signed-long) (preferredheapsize :signed-long) (maxheapsize :signed-long))
  85.    (:stack :signed-long)
  86.    (:stack-trap #xA82A :d0 0 scriptingcomponent modeflags minstacksize preferredstacksize maxstacksize minheapsize preferredheapsize maxheapsize ((+ (ash 28 16) 4097) :signed-longint)))
  87.  
  88. ;  Default Initialization Parameters 
  89.  
  90. (defconstant $kASDefaultMinStackSize 4096)
  91. (defconstant $kASDefaultPreferredStackSize 16384)
  92. (defconstant $kASDefaultMaxStackSize 16384)
  93. (defconstant $kASDefaultMinHeapSize 4096)
  94. (defconstant $kASDefaultPreferredHeapSize 16384)
  95. (defconstant $kASDefaultMaxHeapSize 33554432)
  96.  
  97. ;  Source Styles 
  98.  
  99.  
  100. (deftrap _assetsourcestyles ((scriptingcomponent (:pointer :componentinstancerecord)) (sourcestyles (:handle :testyletable)))
  101.    (:stack :signed-long)
  102.    (:stack-trap #xA82A :d0 0 scriptingcomponent sourcestyles ((+ (ash 4 16) 4098) :signed-longint)))
  103.  
  104.  
  105. (deftrap _asgetsourcestyles ((scriptingcomponent (:pointer :componentinstancerecord)) (resultingsourcestyles (:pointer (:handle :testyletable))))
  106.    (:stack :signed-long)
  107.    (:stack-trap #xA82A :d0 0 scriptingcomponent resultingsourcestyles ((+ (ash 4 16) 4099) :signed-longint)))
  108.  
  109.  
  110. (deftrap _asgetsourcestylenames ((scriptingcomponent (:pointer :componentinstancerecord)) (modeflags :signed-long) (resultingsourcestylenameslist (:pointer :aedesc)))
  111.    (:stack :signed-long)
  112.    (:stack-trap #xA82A :d0 0 scriptingcomponent modeflags resultingsourcestylenameslist ((+ (ash 8 16) 4100) :signed-longint)))
  113.  
  114. (defconstant $kASSourceStyleUncompiledText 0)
  115. (defconstant $kASSourceStyleNormalText 1)
  116. (defconstant $kASSourceStyleLanguageKeyword 2)
  117. (defconstant $kASSourceStyleApplicationKeyword 3)
  118. (defconstant $kASSourceStyleComment 4)
  119. (defconstant $kASSourceStyleLiteral 5)
  120. (defconstant $kASSourceStyleUserSymbol 6)
  121. (defconstant $kASSourceStyleObjectSpecifier 7)
  122. (defconstant $kASNumberOfSourceStyles 8)
  123.  
  124. ; $ENDC                         ;  UsingAppleScript 
  125.  
  126. ; $IFC NOT UsingIncludes
  127.  
  128. ; $ENDC
  129.  
  130. (export '($KASNUMBEROFSOURCESTYLES $KASSOURCESTYLEOBJECTSPECIFIER
  131.           $KASSOURCESTYLEUSERSYMBOL $KASSOURCESTYLELITERAL
  132.           $KASSOURCESTYLECOMMENT $KASSOURCESTYLEAPPLICATIONKEYWORD
  133.           $KASSOURCESTYLELANGUAGEKEYWORD $KASSOURCESTYLENORMALTEXT
  134.           $KASSOURCESTYLEUNCOMPILEDTEXT $KASDEFAULTMAXHEAPSIZE
  135.           $KASDEFAULTPREFERREDHEAPSIZE $KASDEFAULTMINHEAPSIZE
  136.           $KASDEFAULTMAXSTACKSIZE $KASDEFAULTPREFERREDSTACKSIZE
  137.           $KASDEFAULTMINSTACKSIZE $KASHASOPENHANDLER
  138.           $KASSELECTGETSOURCESTYLENAMES $KASSELECTGETSOURCESTYLES
  139.           $KASSELECTSETSOURCESTYLES $KASSELECTINIT $ERRASINCONSISTENTNAMES
  140.           $ERRASNORESULTRETURNED $ERRASPARAMETERNOTFOREVENT
  141.           $ERRASILLEGALFORMALPARAMETER $ERRASTERMINOLOGYNESTINGTOODEEP
  142.           $ERRASCANTCOMPAREMORETHAN32K $ERRASCANTCONSIDERANDIGNORE
  143.           $TYPEASSTORAGE $KAPPLESCRIPTSUBTYPE $TYPEAPPLESCRIPT))
  144. (provide-interface 'AppleScript)